# -*- coding:UTF-8 -*-
"""
@Project : pythonProject
@File    : VerificationDate.py
@IDE     : PyCharm
@Author  : WorldWind(1772830365@qq.com)
@Date    : 2025/7/5 下午3:52
"""

"""
闰年判断方法：
如果年份能够被400整除 或者 年份能被4整除但不能被100整除， 这两个条件满足其一便是闰年: year%400==0 or (year%100!=0 and year%4==0)
"""

try:
    while 1:
        try:
            year,month,day = input("请输入日期,格式参照(2025-01-01):地址").split('-')
            year = int(year) # 年
            month = int(month) # 月
            day = int(day) # 日
            bigMonth = [1,3,5,7,8,10,12] # 大月
            smallMonth = [4,6,9,11] # 小月
            isLeapYear = False # 是否是闰年
            yearLegal = True
            monthLegal = True
            # 判断是否是闰年
            if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
                isLeapYear = True
            else:
                isLeapYear = False
            if year < 0 :
                yearLegal = False
            if month < 0 or month > 12:
                monthLegal = False
            if monthLegal and yearLegal:
                if isLeapYear:
                    if month == 2 and 0 < day <= 29:
                        print(f"您输入的是闰年,日期为:{year}-{month}-{day}")
                        break
                    elif month in bigMonth and 0 < day <= 31:
                        print(f"您输入的是闰年,日期为:{year}-{month}-{day}")
                        break
                    elif month in smallMonth and 0 < day <= 30:
                        print(f"您输入的是闰年,日期为:{year}-{month}-{day}")
                        break
                    else:
                        print("您输入的日期有错误")
                else:
                    if month == 2 and 0 < day <= 28:
                        print(f"您输入的是平年,日期为:{year}-{month}-{day}")
                        break
                    elif month in bigMonth and 0 < day <= 31:
                        print(f"您输入的是平年,日期为:{year}-{month}-{day}")
                        break
                    elif month in smallMonth and 0 < day <= 30:
                        print(f"您输入的是平年,日期为:{year}-{month}-{day}")
                        break
                    else:
                        print("您输入的日期有错误")
            else:
                print("您输入的日期格式有错误!")
        except Exception as e:
            print("您输入内容不正确,请重新输入日期!")
except Exception as e:
    print(e)
else:
    print("The end")